<?php
class links_frame_header
{
	var $mydirname;
	var $controller_name;
	var $Links;

	/** Constructor
	 *
	**/
	function links_frame_header($mydirname)
	{
		$this->mydirname = $mydirname;
		$this->controller_name = str_replace('links_', '', get_class($this));
		$this->Links = links_Base::getInstance($this->mydirname);
		$this->Links->setControllerName($this->controller_name);
		$this->Links->breadcrumbs();

		if ($this->Links->is_mobile) {
			die('PC only');
		}
	}

	function index($lid)
	{
		global $xoopsConfig;

		if ($link = $this->Links->getDataByLid($lid)) {

			require_once XOOPS_ROOT_PATH.'/class/template.php' ;
			$tpl = new XoopsTpl();
			$tpl->register_function('my_make_uri', 'smarty_function_my_make_uri');
			$data = array(
					'link'         => $link,
					'sitename'     => htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES, _CHARSET),
					'uri_options'  => $this->Links->uri_option_arr,
					'mydirname'    => $this->mydirname,
					'request_perm' => $this->Links->request_perm,
				);
			$tpl->assign($data);
			$template = $this->Links->getTemplatePrefix() . '_frame_header.html';
			$tpl->display('db:'. $template);

		} else {
			die('NO DATA');
		}
	}

}
